package com.duobaoyu.dby.supply.api.remote.feign;

import com.duobaoyu.dby.common.core.constant.SecurityConstants;
import com.duobaoyu.dby.common.core.util.R;
import com.duobaoyu.dby.supply.common.biz.remote.dto.order.*;
import com.duobaoyu.dby.supply.common.biz.remote.to.order.CancelOrderTO;
import com.duobaoyu.dby.supply.common.biz.remote.to.order.OrderDetailTO;
import com.duobaoyu.dby.supply.common.biz.remote.to.order.OrderTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import javax.validation.Valid;
import java.util.List;

/**
 * @author fengshaoyu
 * @version 1.0.0
 * <p>订单相关</p>
 * @date 2022/5/28 16:51
 */
@FeignClient(contextId = "remoteSupplyChainBizOrderService", value = "dby-supply-chain-biz-api")
public interface RemoteSupplyChainBizOrderService {

	@ApiOperation("预提交订单")
	@PostMapping("/api/order/submit")
	R<OrderTO> submitOrder(@Validated @RequestBody SubmitOrderDTO submitOrder, @RequestHeader(SecurityConstants.FROM) String from);

	@ApiOperation("订单确认")
	@PostMapping("/api/order/confirm")
	R<Boolean> confirmOrder(@Valid @RequestBody ConfirmOrderDTO confirmOrder, @RequestHeader(SecurityConstants.FROM) String from);

	@ApiOperation("确认收货")
	@PostMapping("/api/order/confirm-receive")
	R<Boolean> confirmReceive(@Valid @RequestBody ConfirmReceiveDTO confirmReceive, @RequestHeader(SecurityConstants.FROM) String from);

	@ApiOperation("取消订单")
	@PostMapping("/api/order/cancel")
	R<List<CancelOrderTO>> cancelOrder(@Valid @RequestBody CancelOrderDTO cancelOrder, @RequestHeader(SecurityConstants.FROM) String from);

	@ApiOperation("订单查询")
	@GetMapping("/api/order/query")
	R<List<OrderDetailTO>> queryOrder(@SpringQueryMap OrderQueryDTO orderQuery, @RequestHeader(SecurityConstants.FROM) String from);
}
